﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.ViewCamera.Rgbd.CUiRgbdConfigWindow
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Markup;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.Ui;
using Tecnomatix.Engineering.Ui.WPF;


namespace DnProcessSimulateCommands.ViewCamera.Rgbd;

public class CUiRgbdConfigWindow : TxWindow, IComponentConnector
{
  private CApRgbdConfigViewModel m_vm;
  private bool CanSetDataChanged;
  internal CUiRgbdConfigWindow m_window;
  internal GroupBox imageCreation;
  internal RadioButton imageCreation_RGBOnly;
  internal RadioButton imageCreation_DepthOnly;
  internal RadioButton imageCreation_RGBD;
  internal GroupBox storageConfig;
  private bool _contentLoaded;

  public CUiRgbdConfigWindow(TxRgbdViewCamera rgbdCamera, ITxRgbdDepthReaderWriter readerWriter)
  {
    this.InitializeComponent();
    this.m_vm = new CApRgbdConfigViewModel(rgbdCamera, readerWriter);
    ((FrameworkElement) this).DataContext = (object) this.m_vm;
  }

  private void btnClose_Click(object sender, RoutedEventArgs e) => ((Window) this).Close();

  private void TxNumericEditBoxControl_GotFocus(object sender, RoutedEventArgs e)
  {
    if (sender is TxNumericEditBoxControl numericEditBoxControl)
      ((UIElement) numericEditBoxControl).GotFocus -= new RoutedEventHandler(this.TxNumericEditBoxControl_GotFocus);
    this.CanSetDataChanged = true;
  }

  private void TxNumericEditBoxControl_TentativeValueChanged(
    object sender,
    TxNumericEditBoxCtrl_TentativeValueChangedEventArgs args)
  {
    if (!this.CanSetDataChanged)
      return;
    this.m_vm.SetDataChanged(args.IsValid);
  }

  [DebuggerNonUserCode]
  [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  public void InitializeComponent()
  {
    if (this._contentLoaded)
      return;
    this._contentLoaded = true;
    Application.LoadComponent((object) this, new Uri("/DnProcessSimulateCommands;component/viewcamera/rgbd/cuirgbdconfigwindow.xaml", UriKind.Relative));
  }

  [DebuggerNonUserCode]
  [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  [EditorBrowsable(EditorBrowsableState.Never)]
  void IComponentConnector.Connect(int connectionId, object target)
  {
    switch (connectionId)
    {
      case 1:
        this.m_window = (CUiRgbdConfigWindow) target;
        break;
      case 2:
        this.imageCreation = (GroupBox) target;
        break;
      case 3:
        this.imageCreation_RGBOnly = (RadioButton) target;
        break;
      case 4:
        this.imageCreation_DepthOnly = (RadioButton) target;
        break;
      case 5:
        this.imageCreation_RGBD = (RadioButton) target;
        break;
      case 6:
        ((UIElement) target).GotFocus += new RoutedEventHandler(this.TxNumericEditBoxControl_GotFocus);
        ((TxNumericEditBoxControl) target).TentativeValueChanged += new TxNumericEditBoxCtrl_TentativeValueChangedEventHandler(this.TxNumericEditBoxControl_TentativeValueChanged);
        break;
      case 7:
        ((UIElement) target).GotFocus += new RoutedEventHandler(this.TxNumericEditBoxControl_GotFocus);
        ((TxNumericEditBoxControl) target).TentativeValueChanged += new TxNumericEditBoxCtrl_TentativeValueChangedEventHandler(this.TxNumericEditBoxControl_TentativeValueChanged);
        break;
      case 8:
        ((UIElement) target).GotFocus += new RoutedEventHandler(this.TxNumericEditBoxControl_GotFocus);
        ((TxNumericEditBoxControl) target).TentativeValueChanged += new TxNumericEditBoxCtrl_TentativeValueChangedEventHandler(this.TxNumericEditBoxControl_TentativeValueChanged);
        break;
      case 9:
        ((UIElement) target).GotFocus += new RoutedEventHandler(this.TxNumericEditBoxControl_GotFocus);
        ((TxNumericEditBoxControl) target).TentativeValueChanged += new TxNumericEditBoxCtrl_TentativeValueChangedEventHandler(this.TxNumericEditBoxControl_TentativeValueChanged);
        break;
      case 10:
        ((UIElement) target).GotFocus += new RoutedEventHandler(this.TxNumericEditBoxControl_GotFocus);
        ((TxNumericEditBoxControl) target).TentativeValueChanged += new TxNumericEditBoxCtrl_TentativeValueChangedEventHandler(this.TxNumericEditBoxControl_TentativeValueChanged);
        break;
      case 11:
        ((UIElement) target).GotFocus += new RoutedEventHandler(this.TxNumericEditBoxControl_GotFocus);
        ((TxNumericEditBoxControl) target).TentativeValueChanged += new TxNumericEditBoxCtrl_TentativeValueChangedEventHandler(this.TxNumericEditBoxControl_TentativeValueChanged);
        break;
      case 12:
        ((UIElement) target).GotFocus += new RoutedEventHandler(this.TxNumericEditBoxControl_GotFocus);
        ((TxNumericEditBoxControl) target).TentativeValueChanged += new TxNumericEditBoxCtrl_TentativeValueChangedEventHandler(this.TxNumericEditBoxControl_TentativeValueChanged);
        break;
      case 13:
        ((UIElement) target).GotFocus += new RoutedEventHandler(this.TxNumericEditBoxControl_GotFocus);
        ((TxNumericEditBoxControl) target).TentativeValueChanged += new TxNumericEditBoxCtrl_TentativeValueChangedEventHandler(this.TxNumericEditBoxControl_TentativeValueChanged);
        break;
      case 14:
        this.storageConfig = (GroupBox) target;
        break;
      case 15:
        ((ButtonBase) target).Click += new RoutedEventHandler(this.btnClose_Click);
        break;
      default:
        this._contentLoaded = true;
        break;
    }
  }
}
